<template>
  <div>
    <p>全选 <input type="checkbox" v-model="isall">
      <button>反选</button>
    </p>
    <ul>
      <li v-for="(obj,index) in arr" :key="index">
        <input type="checkbox" name="" id="" v-model="obj.checked">
        {{obj.name}}
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        arr: [{
            name: "猪八戒",
            checked: false,
          },
          {
            name: "孙悟空",
            checked: false,
          },
          {
            name: "唐僧",
            checked: false,
          },
          {
            name: "白龙马",
            checked: false,
          },
        ]
      }
    },
    computed: {
      isall: {

        set() {
          this.arr.forEach((obj) => {
            obj["checked"] = val;
          })
        },
        get() {

        }
      }
    }
  }
</script>

<style>

</style>